﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HAILN_Y2016CS32ONLINE.Structure_Program.Exer
{
    public partial class Form5 : Form
    {
        public Form5()
        {
            InitializeComponent();
        }

        private void txtgiatri_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int so=-1;
        string ketqua="";
            //while (so < Int32.Parse(txtso.Text))
            //{
                //if (cbokieu.Text.Equals("chan") && (so % 2 == 0))
                //{
                //    ketqua += "-" + so;
                //}
                //else if(cbokieu.Text.Equals("le")&&(so%2!=0))
                //{
                //    ketqua += "-" + so;
                //}
                //switch (kieu)
                //{
                //    case ("chan"):
                //        if (so % 2 == 0) ketqua += "-" + so;
                //        break;
                //    case("le"):
                //        if (so % 2 != 0) ketqua += "-" + so;
                //        break;
                //}
                //so = so + 1;
        //for (int so = 0; so < Int32.Parse(txtso.Text); so = so + 1)
        //{
        //    if (cbokieu.Text.Equals("chan") && (so % 2 == 0))
        //    {
        //        ketqua += "-" + so;
        //    }
        //    else if (cbokieu.Text.Equals("le") && (so % 2 != 0))
        //    {
        //        ketqua += "-" + so;
        //    }

        //}

        do
        {
            
            if (cbokieu.Text.Equals("chan") && (so % 2 == 0))
            {
                ketqua += "-" + so;
            }
            else if (cbokieu.Text.Equals("le") && (so % 2 != 0))
            {
                ketqua += "-" + so;
            }

            so++;
        }
        while (so < Int32.Parse(txtso.Text)  );
      
   
        txtgiatri.Text = ketqua;
        textBox1.Text = (so+1).ToString();
            }
            
        }
       
    }

